home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / ViewIt™ 2.24 Shareware / FaceWare / FaceWare.rsrc / TEXT_1318_BC8. Editable Text.txt < prev    next >
Text File  |  1994-04-10  |  5KB  |  31 lines

  1. Editable Text
  2.   Editable text controls must be of type "Editable", and can be optionally linked to an STR# resource.  When linked to an STR# resource, the string list is used to support "parameter" text that is read just once when the control is initialized.  See "Static Text" for a further discussion of parameter text.
  3.  
  4. Operation
  5.   BaseCt uses TextEdit routines to create and display editable text controls. The editable control's TEHandle can be found in cHiData (after calling GetCtl), and used with TextEdit toolbox calls.  The TE record is an old-style record, meaning that multiple styles are not supported within the same editable text control.
  6.   Editable text controls support the standard menu items Cut (13), Copy (14), Paste (16), Clear (18), and Select All (19).  These menu items can be made available through menu controls in same window, or, for modeless windows, through menus in the main menu bar.
  7.  
  8. Options
  9.   The following bit values can be added to VarCode to set editable text control options:
  10. 1 = always select all of text in control when control becomes selected.  This option mimics standard dialog behavior which selects all text in editable text items as the user tabs between items.
  11. 2 = limit number of characters entered to size of linked string variable.  This option only works when the editable text item is linked to a program string variable (cDataType < 0 - see "Data Links" in the ViewIt Guide for more info on data linking).  Note that this only serves as an input aid for users, since the program never gets back (from GetVal) a string larger than the size of its linked string variable.
  12. 4 = always reselect text in currently selected control after SetVal is executed (otherwise the text is only reselected if changed by SetVal).
  13. 8 = do not allow editing of the text (read only).  This is useful when you need a text item that is selectable but not editable.  A selected, read-only text item, for example, could be used to display and edit the current style settings for an object drawn by the program.
  14. 16384 = use a text handle for data linking instead of a string.  This allows you to data link a program handle to the editable item which can contain more than 255 characters (see "Data Linking" below).
  15.  
  16. FSSC Selection
  17.   If the "Uses FSSC" option is checked in the Control dialog, then the editable text item supports ViewIt's Font, Size, Style, and Color menus.  This means that the user will be able to change the control's text font, size, style, or color using the FSSC menus.  This gives you a simple way to use editable controls to support both the display and selection of font, size, style, and color.  To see an example of this, import the "Text w/ Style Picker" controls into a ViewIt window.  You should then be able to modify the FSSC characteristics of the editable text with the FSSC menus in the menu control.
  18.   To get the text font, size, style, and color chosen by the user, use GetCtl to retrieve this information from the variables cTxFont, cTxSize, cTxFace, and cColors.  To get the content color of the control from the cColors table, use,
  19.  FaceIt(nil,GetFgC,0,-2,ord(cColors),2);
  20. where "2" is the part number corresponding to the control's content, and the color is returned in uRGB.  Also note that for color selection to work properly, the "content" color of the editable control must be set at least once using ViewIt's Style menu in edit mode.
  21.   To set the initial state of such editable controls, use the ViewIt commands StlCtl to set the control's text font, size, and style, and ClrCtl to set content color.
  22.   One way of saving the current text font, size, style, and color settings associated with editable controls in a ViewIt window is to update the associated FWND on disk.  This is easily done by using GetWVC to update the FWND in memory, followed by SavWnd to write the updated FWND to disk.
  23.   To learn more about ViewIt's FSSC menus, see the "FSSC Support" subtopic in the "Controls" topic in the ViewIt Guide.
  24.  
  25. Data Linking
  26.   Editable text controls have "values" equal to a Pascal string containing up to 255 characters (see "Data Links" in the ViewIt Guide for more info on data linking).  As with static text, this makes it easy to have editable text items in ViewIt windows that are directly linked to integer, real, or string program variables.  BaseCt also does elementary filtering of typed characters based on the data type of the linked program variable.  For example, if editable text is linked to an integer, then non-numbers other than "+" or "-" cannot be entered (they just beep).
  27.   If 16384 is added to VarCode, then the "value" of the editable control is a text handle, and you can then link a program handle (data type 11) to the control to transfer more than 255 characters.
  28.  
  29. Limitations
  30.   Although editable text items act as single controls, the "GetCtl..." and "SetCtl..." toolbox calls do not get or set the control's state since no use is made of the control's "contrlValue", "contrlMin", or "contrlMax".
  31.   All limitations of Apple's TextEdit apply (such as 32K per text block).  The global hilite color is always used whether that option is checked or not. No support for hand scrolling.  Must have solid body.